package com.xxx.modules.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.xxx.modules.mapper.BackMapper;
import com.xxx.modules.entity.Back;
import com.xxx.modules.service.BackService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import java.util.List;
import java.util.Arrays;
import com.xxx.modules.utils.TimeUtil;

/**
 * back
 *
 * @author 北易航
 * @since 1.0.0 2022-12-19
 */
@Service
public class BackServiceImpl extends ServiceImpl<BackMapper, Back> implements BackService {

    @Autowired
    private BackMapper backMapper;


    @Override
    public PageInfo<Back> selectBackInfo(Back back, Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        QueryWrapper<Back> wrapper = new QueryWrapper<>();
        List<Back> data = backMapper.selectListInfo(back);
        return new PageInfo<>(data);
    }

    @Override
    public void saveBackInfo(Back back) {
        back.setCreateTime(TimeUtil.getCurrentTime());
        backMapper.insert(back);
    }

    @Override
    public void updateBackInfo(Back back) {
        backMapper.updateById(back);
    }

    @Override
    public void delBackInfo(Integer id) {
        backMapper.deleteById(id);
    }

    @Override
    public void delBatchBackInfo(String idList) {
        List<String> list = Arrays.asList(idList.split(","));
        backMapper.deleteBatchIds(list);
    }


}